package com.dabai.iot.mqtt.api;

import com.dabai.iot.mqtt.model.DeviceConnectionSession;
import com.dabai.iot.mqtt.model.ServerClient;

import java.util.List;

/**
 * MQTT 服务
 *
 * @author kev1n
 */
public interface RemoteMqttService {

    /**
     * 获取设备的连接会话
     */
    DeviceConnectionSession getDeviceConnectionSession(String productKey, String deviceSn);

    /**
     * 关闭设备的连接会话
     */
    void closeDeviceConnectionSession(String traceId, String productKey, String deviceSn);

    /**
     * 通过消费组获取对应的订阅服务端列表
     */
    List<ServerClient> getServerClientList(String groupID);

    /**
     * 通过 IoT 平台给设备发消息
     */
    void sendMessageToDevice(String traceId, String productKey, String deviceSn, String topic, String payload);

    /**
     * 给服务端发消息
     */
    void sendMessageToServer(String traceId, Long consumerId, String groupID, String topic, String payload);

}
